package com.wl2o2o.lanqiao.xzfourteen;

import java.util.Arrays;
import java.util.Scanner;


/** 
* @author : WLei224
* @date ：2023年2月6日 上午12:40:16 
* 
*/
public class Reverse {

	public static void main(String[] args) {
		int n = 0, sum = 0;
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()) { //循环输入用于测试数据
			n = scanner.nextInt();
			String string = scanner.next();
			
			char[] array = string.toCharArray();
			System.out.println(Arrays.toString(array));
			numReverse(n);
			System.out.println(stringReverse(n));
			System.out.println(stringReverse(string));
			System.out.println(charAtReverse(string));
		}
		//数位反转numReverse
		
		
	}
	//数位反转numReverse
	public static void numReverse(int n) {
		int sum = 0;
		while(n>0) {
			System.out.print(n%10);
			sum = sum*10 + n%10;
			n /= 10;
		}
		System.out.println();
	}
	
	//字符反转API
	public static String stringReverse(int n) {
		return new StringBuffer(String.valueOf(n)).reverse().toString();
	}
	//字符反转
	public static String stringReverse(String s){
		   StringBuffer sb = new StringBuffer(s);
		   String afterReverse = sb.reverse().toString();
		   return afterReverse;
	}
	public static String charAtReverse (String s){
		   int length = s.length();
		   String reverse = " ";
		   for (int i = 0; i < length; i++) {
		    reverse = s.charAt(i)+reverse;//字符串中获取单个字符的字符的放法
		   }
		   return reverse;
	}


}
